<%@page import="org.springframework.scheduling.annotation.Scheduled"%>
<%@page import="org.springframework.security.core.context.SecurityContextHolder"%>
<%@page import="org.apache.commons.lang.StringUtils"%>
<%@page import="org.apache.commons.lang.time.DateFormatUtils"%>
<%@page import="org.springframework.util.CollectionUtils"%>
<%@page import="java.util.Collection"%>
<%@ include file="../common/common_include.jsp"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	UserInfo user = (UserInfo)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
	String username = user.getName();
	String siteid = user.getSiteId();
	TblCheckSchedule schedule = null;
	if (null != request.getAttribute("schedule")){
		schedule = (TblCheckSchedule) request.getAttribute("schedule");
	}
	String siteId = schedule.getSiteid();
	String userId = schedule.getUserid();
	String shiftId = schedule.getShiftid()+"";
	String startdate = DateFormatUtils.format(schedule.getStartdate(), "yyyy-MM-dd");
	String enddate =  DateFormatUtils.format(schedule.getEnddate(), "yyyy-MM-dd");
	
	String isCheck = schedule.getIsCheck();
	String isHoliday = schedule.getIsHodliday();
	String isOvertime = schedule.getIsOvertime();
	String workDays = schedule.getWorkDays();
%>

<style>
	.selectHour-split{
		padding:0 2px;
		margin-right:5px;	
	}
	.selectMinute-split{
		padding:0 2px;
	}
</style>

<div>
	<form id="LeaveAddForm" target="_coreIframe" method="post" action="<%=request.getContextPath()%>/check/doEditSchedule" enctype="multipart/form-data">
		<div class="breadcrumb">
			<div class="bcIcon"></div>
			<ul class="bcNav">
				<li>人员排班</li>
			</ul>
		</div>
		<table class="formTable">
			<tr>
				<td class="tdTitle">所属公司：</td>
				<td>
					<select id="siteList" class="easyui-combobox" name="siteid" style="width:100px;"></select>
					<span class="errorTipWrap" id="errorTip_siteid"></span>
				</td>
			</tr>
			<tr>
				<td class="tdTitle">员工：</td>
				<td>
					<select id="userList" class="easyui-combobox" name="userid" style="width:200px;"></select>
					<span class="errorTipWrap" id="errorTip_userid"></span>
				</td>
			</tr>
			<tr>
				<td class="tdTitle">使用班次：</td>
				<td>
					<select id="shiftid" class="easyui-combobox" name="shiftid" style="width:200px;"></select>
					<span class="errorTipWrap" id="errorTip_userid"></span>
				</td>
			</tr>
			<tr>
				<td class="tdTitle">排班开始日期：</td>
				<td>
				<input class="inputText xxs" type="text" name="startDate" value="<%=startdate%>" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})">
				<span class="errorTipWrap" id="errorTip_startDate"></span>
				</td>
			</tr>
			<tr>
				<td class="tdTitle">排班结束日期：</td>
				<td>
				<input class="inputText xxs" type="text" name="endDate"  value="<%=enddate%>" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})">
				<span class="errorTipWrap" id="errorTip_startDate"></span>
				</td>
			</tr>
<%-- 			<tr>
				<td class="tdTitle">特殊设置：</td>
				<td class="" colspan="2">
						<div class="checkbox-wrap">
							<label>
								<input <%=StringUtils.equalsIgnoreCase("1", isCheck)?"checked=checked":""%> type="checkbox" value="1" name="isCheck" class="checkbox" >
								<span>是否考勤</span>
							</label>
							<label>
								<input <%=StringUtils.equalsIgnoreCase("1", isHoliday)?"checked=checked":""%> type="checkbox" value="1" name="isHoliday" class="checkbox" >
								<span>节假日有效</span>
							</label>
							<label>
								<input <%=StringUtils.equalsIgnoreCase("1", isOvertime)?"checked=checked":""%> type="checkbox" value="1" name="isOvertime" class="checkbox" >
								<span>计算加班</span>
							</label>
						</div>
					</td>
			</tr> --%>
<!-- 			<tr>
				<td class="tdTitle">考勤日：</td>
				<td class="" colspan="2">
						<div class="checkbox-wrap">
							<input type="hidden" name="workDays">
							<label>
								<input type="checkbox" class="checkbox workDays_checkbox" s="1">
								<span>星期一</span>
							</label>
							<label>
								<input type="checkbox" class="checkbox workDays_checkbox" s="2">
								<span>星期二</span>
							</label>
							<label>
								<input type="checkbox" class="checkbox workDays_checkbox" s="3">
								<span>星期三</span>
							</label>
							<label>
								<input type="checkbox" class="checkbox workDays_checkbox" s="4">
								<span>星期四</span>
							</label>
							<label>
								<input type="checkbox" class="checkbox workDays_checkbox" s="5">
								<span>星期五</span>
							</label>
							<label>
								<input type="checkbox" class="checkbox workDays_checkbox" s="6">
								<span>星期六</span>
							</label>
							<label>
								<input type="checkbox" class="checkbox workDays_checkbox" s="7">
								<span>星期日</span>
							</label>
						</div>
					</td>
			</tr> -->
			<tr>
				<td class="tdTitle"></td>
				<td>
					<div>
						<input class="input-btn-microsoft" type="submit" value="提交">
						<a class="a-btn-microsoft" href="javascript:XF.NAV.navTo('/check')">取消</a>
					</div>
				</td>
			</tr>	
		</table>
		<input type="hidden" value="<%=username %>" name="addUser"> 	
		<input type="hidden" value="<%=EncrypTool.encode(schedule.getId()+"") %>" name="id"> 
	</form>
	<iframe id="_coreIframe" name="_coreIframe" style="display: none;"></iframe>
</div>
<script>
$('#siteList').combobox({
	url:global.contextPath + '/company/siteList',
	valueField:'siteid',
	textField:'sitename',
	onSelect:function(){
		var siteid = $("#siteList").combobox('getValue');
		XF.Check.DefaultSiteId = siteid;
		$("#userList").combobox('reload',global.contextPath + '/company/userListBysiteId?siteid='+siteid);	
		$("#shiftid").combobox('reload',global.contextPath + '/check/shiftListBySiteId?siteid='+siteid);	
	}
});

$("#userList").combobox({
	url:global.contextPath + '/company/userListBysiteId?siteid=' + '<%=siteId%>',
	valueField:'userid',
	textField:'username',
});

$("#shiftid").combobox({
	url:global.contextPath + '/check/shiftListBySiteId?siteid=' + '<%=siteId%>',
	valueField:'id',
	textField:'shiftName',
});

XF.Check.init();
$('#siteList').combobox('setValue', '<%=siteId%>');
$('#userList').combobox('setValue', '<%=userId%>');
$('#shiftid').combobox('setValue', '<%=shiftId%>');
</script>


			
